package com.djhu.es.core;

import com.djhu.es.core.request.AddRequest;
import com.djhu.es.core.request.IdRequest;
import com.djhu.es.core.request.SearchRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexResponse;

import java.util.List;
import java.util.Map;

public interface ElasticsearchOperations {


    Map<String,Object> get(IdRequest request) throws Exception;

    <T> T get(IdRequest request, Class<T> tClass) throws Exception;

    DeleteResponse del(IdRequest request) throws Exception;

    IndexResponse add(AddRequest request) throws Exception;

    public Map queryforMap(SearchRequest  searchRequest) throws Exception;

    <T>  List<T> queryforlist(SearchRequest searchRequest, Class<T> tClass) throws Exception;

    <T>  List<T> queryforlist(SearchRequest searchRequest, RowMapper<T> rowMapper) throws Exception;

    public List<Map<String, Object>> queryforList(SearchRequest searchRequest) throws Exception;

    <T> T queryForObject(SearchRequest  searchRequest, Class<T> tClass) throws Exception;


    public <T> T queryForObject(SearchRequest  searchRequest, RowMapper<T> rowMapper) throws Exception;

    <T> T execute(SearchRequest searchRequest, SearchResponseCallback<T> action) throws Exception;

    <T> T execute(SearchRequest searchRequest, ResultExtractor<T> rse)  throws Exception;
}
